/**
    File        : LicenseDlg.h
    Description : Dialog for displaying license
    Author      : Raymond Marsh
    Created     : 08/01/2009
    Copyright 2009, 2010, 2011, 2012 Raymond Marsh

    This program is distributed under the terms of the GNU General Public License.
    To view a copy of the license see the file 'copying.txt'

    This file is part of the MyMoney Suite.

    MyMoney is free software: you can redistribute it and/or modify it under
    the terms of the GNU General Public License as published by the Free Software Foundation, either
    version 3 of the License, or (at your option) any later version.

    MyMoney is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along with MyMoney.
    If not, see <http://www.gnu.org/licenses/>.
**/

#include "..\include\LicenseDlg.h"

const wxString g_FileName = "COPYING.txt";

//(*InternalHeaders(CLicenseDlg)
#include <wx/xrc/xmlres.h>
//*)

//(*IdInit(CLicenseDlg)
//*)

BEGIN_EVENT_TABLE(CLicenseDlg,wxDialog)
	//(*EventTable(CLicenseDlg)
	//*)
END_EVENT_TABLE()

CLicenseDlg::CLicenseDlg(wxWindow* parent, const bool ViewOnly)
{
	//(*Initialize(CLicenseDlg)
	wxXmlResource::Get()->LoadObject(this,parent,_T("CLicenseDlg"),_T("wxDialog"));
	//*)

	// set the button(s)
	wxStdDialogButtonSizer* pBtnSizer = new wxStdDialogButtonSizer();
	if (ViewOnly)
    {
        pBtnSizer->AddButton(new wxButton(this, wxID_OK, _("OK") ) );
    }
    else
    {
        pBtnSizer->AddButton(new wxButton(this, wxID_OK, _("Accept") ) );
        pBtnSizer->AddButton(new wxButton(this, wxID_CANCEL, _("Decline") ) );
    }
    pBtnSizer->Realize();

	wxSizer* pSizer = GetSizer();
	pSizer->Add(pBtnSizer, wxSizerFlags(1).Border(wxALL, 5) );
	SetSizerAndFit(pSizer);

    // set the textbox font and size
    wxFont font(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
    this->SetFont(font);

    // load the license file
    if (!TextCtrl1->LoadFile(g_FileName) )
        mmFatalErrorDlg(this, _("Could not find License File!") );
}

CLicenseDlg::~CLicenseDlg()
{
	//(*Destroy(CLicenseDlg)
	//*)
}

